#coding=utf-8
import matplotlib.pyplot as plt
import  numpy as np
import matplotlib as mpl
mpl.rcParams['font.sans-serif'] = ['KaiTi','SimHei','FangSong'] #汉字字体，优先使用楷体，如果找不到楷体，则使用黑体
mpl.rcParams['font.size'] = 12 #字体大小
mpl.rcParams['axes.unicode_minus'] = False #正常显示负号
def get_result(list):
    plt.rcParams['font.sans-serif'] = ['Microsoft YaHei']
    plt.rcParams['axes.unicode_minus'] = False
    fig = plt.figure(figsize=(24, 4))
    plt.title("未解决bug数量")
    plt.xlabel("对应开发人员")
    plt.ylabel("bug数量")
    width = 0.1  # 柱子的宽度
    x = np.arange(len(list[0][1]))
    # print("长度："+str(len(list[0][1])))
    x = x - len(list) / 2 * width
    k = 1
    for item in list:
        list_x, list_y = zip(*item[1].items())
        plt.bar(x + width, list_y, label=item[0], alpha=1, width=width)
        plt.xticks(np.arange(len(list_x)), list_x)
        for x_zhyd, y_zhyd in enumerate(list_y):
            if y_zhyd != 0:
                # print(x_zhyd + k * width - len(list) / 2 * width, y_zhyd)
                plt.text(x_zhyd + k * width - len(list) / 2 * width, y_zhyd, '%s' % y_zhyd)
        x = x + width
        k += 1
        # print(item[0])
        # print(str(list_x))
        # print(str(list_y))
    plt.legend()
    # print("---------------")
    # print(-0.1 + 0.1)
    plt.savefig("test1.jpg")
    plt.show()
if __name__ == '__main__':
    print(mpl.matplotlib_fname())
    fm =mpl.get_cachedir()
    print(fm)
